﻿Imports Microsoft.Reporting.WebForms
Public Class ReporteEquipo
    Inherits System.Web.UI.Page

    Dim strIP As String
    Dim strMAC As String
    Dim strNombre As String

    Private Sub principal(ByVal strIP As String, ByVal strMAC As String, ByVal strNombre As String)
        Me.ReportViewer1.LocalReport.ReportPath = ("reportes\ReporteEquiposIPMACPC.rdlc")
        Me.ReportViewer1.LocalReport.DataSources.Clear()

        Dim adapter As New DataSetTableAdapters.USP_CONSULTA_TB_EQUIPO_X_IPTableAdapter
        Dim table As New DataSet.USP_CONSULTA_TB_EQUIPO_X_IPDataTable

        'adapter.FillTb_Equipo(table, strIP, strMAC, strNombre)
        'adapter.FillTb_Equipo(table, strIP, strMAC)
        adapter.FillTb_Equipo(table, strIP)

        Me.ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("dsEquipos", CType(table, DataTable)))
        Me.ReportViewer1.DataBind()

    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btnConsultar_Click(sender As Object, e As EventArgs) Handles btnConsultar.Click

        If txtIP.Text.Length = 0 Then
            strIP = Nothing
        Else
            strIP = txtIP.Text
        End If

        If txtMAC.Text.Length = 0 Then
            strMAC = Nothing
        Else
            strMAC = txtMAC.Text
        End If

        If txtNombre.Text.Length = 0 Then
            strNombre = Nothing
        Else
            strNombre = txtNombre.Text
        End If

        principal(strIP, strMAC, strNombre)
    End Sub
End Class